import logging

from airflow.models.idata_auth_resource import AuthResource
from airflow.models.idata_auth_role_resource import AuthRoleResource
from airflow.utils.session import provide_session

log = logging.getLogger(__name__)


@provide_session
def delete_resource(id, session=None):
    AuthResource.delete_resource(id, session)
    AuthRoleResource.delete_role_resource_by_resourceid(id, session)
